package agent;

import processing.core.PVector;

public class SquareBehavior extends Behavior {
	
	SquareBehavior(Main p) {
		super(p);
	}
	
	public void apply(Agent a) {
		p.rectMode(p.CENTER);
		PVector[] positions = a.getPositions();
		int drawColor;
		for (int i = 0; i < positions.length; i++) {
			drawColor = p.color(p.hue(a.colors[0]),p.saturation(a.colors[0]),p.brightness(a.colors[0]),(positions.length-i)*255/positions.length);
			p.fill(drawColor);
			p.rect(positions[i].x, positions[i].y, i*5, i*5);
		}
	}
	
}
